%Paul Ozog
%Noise
%HW 6

M = 100;
N = 1000;

W = 2*randint(N, M)-1;
X = cumsum(W,1);

figure('units','normalized','position',[0.1,0.1,0.8,0.8]);
plot([1:N],X,[0,N],[0,0],'W:'); 
title('Random Walks','fontsize',18);
xlabel('n','fontsize',16); 
ylabel('Amplitude','fontsize',16);

%Plot the mean of each walk as a discrete function of n
figure;
muX = sum(X,2) / M;
plot(muX);

%Plot the variance of each walk as a discrete function of n
figure;
varX = (sum(X.^2, 2) / M) - muX.^2;
plot(varX);
